package com.sx.gongzhong.pest;

import android.content.Context;

import com.sx.gongzhong.model.CheckInBean;
import com.sx.gongzhong.model.CheckRecords;
import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.ApiManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.view.CheckInPestView;

import java.util.Map;

/**签到
 * Created by admin on 2017/12/29.
 */

public class CheckInPest {
    private CheckInPestView checkInPestView;

    public CheckInPest(CheckInPestView checkInPestView) {
        this.checkInPestView = checkInPestView;
    }
    public void setCheckIn(Context context){
        Map<String,Object> map= HeadParamBean.getHead();
        new ApiManager().setCheckIn(map, new BaseCallBack<ReplyUserBean.BaseResult<CheckRecords>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<CheckRecords> response) {
                checkInPestView.setCheckInSuccess(response.getData());
            }
            @Override
            public void onFailures(String message) {
                checkInPestView.showError("签到失败");
            }
        });
    }
    public void getCheckInCount(String countMonth){
        Map<String,Object> map= HeadParamBean.getHead();
        map.put("countMonth",countMonth);
        new ApiManager().getCheckInCount(map, new BaseCallBack<ReplyUserBean.BaseResult<CheckInBean>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<CheckInBean> response) {
                checkInPestView.getCheckInCount(response.getData());
            }
            @Override
            public void onFailures(String message) {
                checkInPestView.showError(message);
            }
        });
    }

//    public void getCheckInList(int year,int month) {
//        Map<String,Object> map= HeadParamBean.getHead();
//        map.put("year",year);
//        map.put("month",month);
//        new ApiManager().getCheckInList(map, new BaseCallBack<BaseResult<List<CheckRecords>>>() {
//            @Override
//            public void onSuccess(BaseResult<List<CheckRecords>> response) {
//                checkInPestView.getCheckInList(response.getData());
//            }
//            @Override
//            public void onFailures(String message) {
//                checkInPestView.showError(message);
//            }
//        });
//    }
}
